home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
rwini
/
rwini.frm
< prev
next >
Wrap
Text File
|
1995-05-02
|
7KB
|
254 lines
VERSION 2.00
Begin Form frmINI
BackColor = &H00C0C0C0&
Caption = "Read-Write INI Sample"
ClientHeight = 3240
ClientLeft = 1155
ClientTop = 2190
ClientWidth = 7740
Height = 3645
Icon = RWINI.FRX:0000
Left = 1095
LinkTopic = "Form1"
ScaleHeight = 3240
ScaleWidth = 7740
Top = 1845
Width = 7860
Begin CommandButton Command12
Caption = "Exit"
Height = 495
Left = 3120
TabIndex = 15
Top = 2520
Width = 1215
End
Begin TextBox Text4
Height = 285
Left = 1800
TabIndex = 3
Top = 1320
Width = 1935
End
Begin CommandButton Command11
Caption = "Read Phone"
Height = 255
Left = 3960
TabIndex = 10
Top = 1320
Width = 1575
End
Begin CommandButton Command10
Caption = "Write Phone"
Height = 255
Left = 5640
TabIndex = 11
Top = 1320
Width = 1575
End
Begin CommandButton Command9
Caption = "Clear All"
Height = 495
Left = 4440
TabIndex = 14
Top = 1920
Width = 1215
End
Begin CommandButton Command8
Caption = "Write All"
Height = 495
Left = 3120
TabIndex = 13
Top = 1920
Width = 1215
End
Begin CommandButton Command7
Caption = "Read All"
Height = 495
Left = 1800
TabIndex = 12
Top = 1920
Width = 1215
End
Begin CommandButton Command6
Caption = "Write Company"
Height = 255
Left = 5640
TabIndex = 9
Top = 960
Width = 1575
End
Begin CommandButton Command5
Caption = "Write Name"
Height = 255
Left = 5640
TabIndex = 7
Top = 600
Width = 1575
End
Begin CommandButton Command4
Caption = "Write Serial"
Height = 255
Left = 5640
TabIndex = 5
Top = 240
Width = 1575
End
Begin CommandButton Command3
Caption = "Read Company"
Height = 255
Left = 3960
TabIndex = 8
Top = 960
Width = 1575
End
Begin CommandButton Command2
Caption = "Read Name"
Height = 255
Left = 3960
TabIndex = 6
Top = 600
Width = 1575
End
Begin TextBox Text3
Height = 285
Left = 1800
TabIndex = 2
Top = 960
Width = 1935
End
Begin TextBox Text2
Height = 285
Left = 1800
TabIndex = 1
Top = 600
Width = 1935
End
Begin CommandButton Command1
Caption = "Read Serial"
Height = 255
Left = 3960
TabIndex = 4
Top = 240
Width = 1575
End
Begin TextBox Text1
Height = 285
Left = 1800
TabIndex = 0
Top = 240
Width = 1935
End
Begin Label Label4
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Phone:"
Height = 255
Left = 480
TabIndex = 19
Top = 1320
Width = 1215
End
Begin Label Label3
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Company:"
Height = 255
Left = 480
TabIndex = 18
Top = 960
Width = 1215
End
Begin Label Label2
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Name:"
Height = 255
Left = 1080
TabIndex = 17
Top = 600
Width = 615
End
Begin Label Label1
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Serial Number:"
Height = 255
Left = 360
TabIndex = 16
Top = 240
Width = 1335
End
End
Option Explicit
Sub Command1_Click ()
text1.Text = GetFromINI("Serial", "SerialNumber", inipath$)
End Sub
Sub Command10_Click ()
entry$ = text4.Text
r% = WritePrivateProfileString("UserInfo", "Phone", entry$, inipath$)
If r% <> 1 Then MsgBox "An error occurred while writing Phone."
End Sub
Sub Command11_Click ()
text4.Text = GetFromINI("UserInfo", "Phone", inipath$)
End Sub
Sub Command12_Click ()
End
End Sub
Sub Command2_Click ()
text2.Text = GetFromINI("UserInfo", "Name", inipath$)
End Sub
Sub Command3_Click ()
text3.Text = GetFromINI("UserInfo", "Company", inipath$)
End Sub
Sub Command4_Click ()
entry$ = text1.Text
r% = WritePrivateProfileString("Serial", "SerialNumber", entry$, inipath$)
If r% <> 1 Then MsgBox "An error occurred while writing SerialNumber."
End Sub
Sub Command5_Click ()
entry$ = text2.Text
r% = WritePrivateProfileString("UserInfo", "Name", entry$, inipath$)
If r% <> 1 Then MsgBox "An error occurred while writing Name."
End Sub
Sub Command6_Click ()
entry$ = text3.Text
r% = WritePrivateProfileString("UserInfo", "Company", entry$, inipath$)
If r% <> 1 Then MsgBox "An error occurred while writing Company."
End Sub
Sub Command7_Click ()
text1.Text = GetFromINI("Serial", "SerialNumber", inipath$)
text2.Text = GetFromINI("UserInfo", "Name", inipath$)
text3.Text = GetFromINI("UserInfo", "Company", inipath$)
text4.Text = GetFromINI("UserInfo", "Phone", inipath$)
End Sub
Sub Command8_Click ()
Command4_Click
Command5_Click
Command6_Click
Command10_Click
End Sub
Sub Command9_Click ()
text1.Text = ""
text2.Text = ""
text3.Text = ""
text4.Text = ""
End Sub
Sub Form_Load ()
inipath$ = app.Path + "\rwini.ini"
Command7_Click
End Sub